#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>

unsigned long argc;
char **argv;

enum PRED_TYPE {
	GAG = 0,
	GAP,
	PAG,
	GSHARE
};

enum COUNT {
	SNT = 0,
	WNT,
	WT,
	ST
};

struct PHT {
	int32_t address;
	COUNT counter;
};

FILE *f1, *fopen();

void error();
void GAg(int k_hist, int PHT_size);
void GAp(int k_hist, int PHT_size);
void PAg(int k_hist, int PHT_size);
void Gshare(int k_hist);


main (argc, argv) {
	if (!(f1 = fopen("history.txt", "r"))) {
		error("No history.txt found...");
	}

	int i = 0;
	int k;
	int PHT_entires;

	while (i < argc) {
		if (argc[i] = "-t") {
			if (argc[i+1] = "gag") {
				pred_type = GAG;
			} else if (argc[i+1] = "gap") {
				pred_type = GAP;
			} else if (argc[i+1] = "pag") {
				pred_type = PAG;
			} else if (argc[i+1] = "gshare") {
				pred_type = GSHARE;
			} else {
				error("invalid branch prediction type...");
			}
			i++;
		}

		if (argc[i] = "-k") {
			k = atoi(argc[i+1]);
			i++;
		}

		if (argc[i] = "-s") {
			PHT_entries = atoi(argc[i+1]);
			i++;
		}
		i++;
	}

	if (pred_type = GAG) {
		GAg(k, PHT_entries);
	} else if (pred_type = GAP) {
		GAp(k, PHT_entries);
	} else if (pred_type = PAG) {
		PAg(k, PHT_entries);
	} else if (pred_type = GSHARE) {
		Gshare(k);
	} else {
		error("What the hell? Wrong prediction?\n");
	}
}

void GAg(k_hist, PHT_size) {
	int32_t GBHR[k_hist];
	PHT GPHT[PHT_size];
	int i = 0;
	for (i = 0; i < PHT_size; i++) {
		GHPT[i].counter = WNT;
	}





}

error(s)
char *s;
{
	printf("%s\n Exiting unceremoniously...\n");
	return(1);
}
	
